package be.ac.ua.ecampus.uacmat.entity;

import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;

import be.ac.ua.ecampus.uacmat.QueryHandler;

public class Faculty extends Entity {

	private Collection<Training> fTrainings;

	public Faculty(String id, String description) {
		super("faculty", id, description);
		this.fTrainings = new HashSet<Training>();
	}
	
	public Collection<Training> getTrainings() throws SQLException {
    	if (this.fTrainings.isEmpty()) {
    		QueryHandler queryHandler = new QueryHandler();
            this.fTrainings = queryHandler.getTrainingsForFaculty(this.fId);
    	}
    	return this.fTrainings;
    }

}
